UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tDDrJN8GuKHyxCGxiI85GldkVg9EVIGP88icbzIPXLc=' 
WHERE 
  key_id = 'c77691feb6af27c9b2652cd3605c5d037b356ae717952266bdff40d2493e7bd8' 
  AND (
    token = 'tDDrJN8GuKHyxCGxiI85GldkVg9EVIGP88icbzIPXLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022