UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0aHD86+xJfzeGRs+qAXCrs57aRmk3icp0iVuOBpgP7U=' 
WHERE 
  key_id = 'b2fb0ad285974e8060be5bc77087518db81b49fb75314b9a411ac688dbc5711d' 
  AND (
    token = '0aHD86+xJfzeGRs+qAXCrs57aRmk3icp0iVuOBpgP7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028