UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZgcTPXEfEu/kkhlgc/0VzS1rEpQnNNbLoptM6Vn7kI=' 
WHERE 
  key_id = '969e11bf5e77eff8c789361b68d8a71330616e253fde3bf30fa647ca44bcfabd' 
  AND (
    token = 'AZgcTPXEfEu/kkhlgc/0VzS1rEpQnNNbLoptM6Vn7kI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046