UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQ9UXZ+38z+30D/CxWha/oaUdsdFoweCPW/I7gsyUpM=' 
WHERE 
  key_id = '2fe3afa0c4a007c9a0fe10cf5e253bb1e98c9c9980f2ca8f5c02504192711538' 
  AND (
    token = 'iQ9UXZ+38z+30D/CxWha/oaUdsdFoweCPW/I7gsyUpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037