UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8Dff4YEbZwnG232dKLsICANwxgbbcwIBxTNkCTscV8=' 
WHERE 
  key_id = '5b610b28f2e68cc4c5d07a1258766a5878e241c0a7f77b5da7993356a52706e5' 
  AND (
    token = 'p8Dff4YEbZwnG232dKLsICANwxgbbcwIBxTNkCTscV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036