UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avSpPENTorxTToJBz0Z8fbjRDgNpwfo03OjL4TE3z5o=' 
WHERE 
  key_id = '1443492720fe93b4b9e9940e404a1a5611044fa3addd03d3fbc0e7a6064ada5d' 
  AND (
    token = 'avSpPENTorxTToJBz0Z8fbjRDgNpwfo03OjL4TE3z5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041