UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pbh6Q9aexSD0tYsjwW8iiZRvEzn+G303jqhDrONaUCo=' 
WHERE 
  key_id = '2d50db1e5198af409d9a2afa94bab2d34c7c214c058b8bf91e50526efd451fea' 
  AND (
    token = 'Pbh6Q9aexSD0tYsjwW8iiZRvEzn+G303jqhDrONaUCo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046