UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z1fLzwOQNIoucLtTxr2+3WX5Xn9UBKTb6jfE6pfJPUY=' 
WHERE 
  key_id = '18e427b1798cabb4b77d4fd92e754b397b5e1a4df9c97efe7ffb442553b8b054' 
  AND (
    token = 'z1fLzwOQNIoucLtTxr2+3WX5Xn9UBKTb6jfE6pfJPUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045