UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oxCAdc5166TqDC07RtpJeP6BYWOWZlHe4E1IsY+ePQM=' 
WHERE 
  key_id = '134d4ee2f2bfd91847febf458bac4097c7f10aa213a63b0cdc69b720db076c87' 
  AND (
    token = 'oxCAdc5166TqDC07RtpJeP6BYWOWZlHe4E1IsY+ePQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030