UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3R7QMa9fdCRcgjSry7/OQRfJ57uL9QSO42b7VPs3RH8=' 
WHERE 
  key_id = 'c83bbaac9d11ae7ca967722109bd51eb4288744d1a2e5772f64b804e367984b5' 
  AND (
    token = '3R7QMa9fdCRcgjSry7/OQRfJ57uL9QSO42b7VPs3RH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042