UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bx0SUDJDfI/oO8EAppl3bk8cZpbJRRRe2+qIkC926P0=' 
WHERE 
  key_id = 'cf6fde067620efc0ab74a400529df712bc10ad90fab04ed15c4332cb8336e224' 
  AND (
    token = 'Bx0SUDJDfI/oO8EAppl3bk8cZpbJRRRe2+qIkC926P0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040