UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GpwvwH51Zb+p8l+49+Q6BaffvWR/73NbaX+Z+nAC/k8=' 
WHERE 
  key_id = 'ecc416ac442bbd260abbfba0b432161f0fade18895cc8dc229afa61c4c458442' 
  AND (
    token = 'GpwvwH51Zb+p8l+49+Q6BaffvWR/73NbaX+Z+nAC/k8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024