UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'usByRopB9IRpsMSsHdA335mUWCMzJf06Ox1azWUPb+4=' 
WHERE 
  key_id = 'd96da522240372b5731fefd6c3799459d8136f485fb367d04fc2b0c24168ba85' 
  AND (
    token = 'usByRopB9IRpsMSsHdA335mUWCMzJf06Ox1azWUPb+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033