UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8swINrDsx7UaZPXVckMM9j/L5aqgNtKSVyERt+oafB0=' 
WHERE 
  key_id = '4903eb2bc0763b122e9c3774d60438f7c4d2b6a101d8fae6edebc951d7c1772d' 
  AND (
    token = '8swINrDsx7UaZPXVckMM9j/L5aqgNtKSVyERt+oafB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033