UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sd3msvxw76o1cJgxk7DpGfc+O8+wtIR6ECUythR8UV4=' 
WHERE 
  key_id = '681885cade47d738286e4d9cdaf98263857b0b70ddd354d9640c85b688470460' 
  AND (
    token = 'sd3msvxw76o1cJgxk7DpGfc+O8+wtIR6ECUythR8UV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051