UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VOfnu4sjcvhIgKYvze9W/nryN/ZlLaqUaLnMK51y+Dw=' 
WHERE 
  key_id = '4d970b4c05bfc0eec26cc21f1f22991a523dcaf5bb71460d805522075d79d3be' 
  AND (
    token = 'VOfnu4sjcvhIgKYvze9W/nryN/ZlLaqUaLnMK51y+Dw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033