UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+FiDV7di6yiAjdh10TsjKb2Gh7KNd4TI1y7QECiUX8=' 
WHERE 
  key_id = '40c00b7b745f9aa7f07a15e097b675745020245a28f6f7603556196616c88786' 
  AND (
    token = 'D+FiDV7di6yiAjdh10TsjKb2Gh7KNd4TI1y7QECiUX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026