UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KO8X1oRPct9kAPz9qFnkGvmh1tnstR/8h+3NjNesTb4=' 
WHERE 
  key_id = 'f3d08232f53c541f37c2e9fd1f584b6b7165cf69c8d24fda0a538252ff1c0415' 
  AND (
    token = 'KO8X1oRPct9kAPz9qFnkGvmh1tnstR/8h+3NjNesTb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026