UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eT3hJTdjBvMOGMUyQHst58PHtDSUNSzAlonEp2VsB+Y=' 
WHERE 
  key_id = 'a8f182cff967339f30998fc5948a5cc17167578cd75acc19d0818ee90353c0fd' 
  AND (
    token = 'eT3hJTdjBvMOGMUyQHst58PHtDSUNSzAlonEp2VsB+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034