UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R1w2H+Y2MEj/U3AikxBZP9KGgMcQtV5DsrJpPR/u5qE=' 
WHERE 
  key_id = '9219ba71abec97cd51e8876e8b12a68817ef50169c449805af342c6fa18c05a7' 
  AND (
    token = 'R1w2H+Y2MEj/U3AikxBZP9KGgMcQtV5DsrJpPR/u5qE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037