UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5V1AE7ah6YuP+4jKMV/wA8W4KazFqVtlXurMbaQ7mGw=' 
WHERE 
  key_id = 'd332af5d1a6b0efc0d50ceb1006212d747e1c00270ce68d656688f037f33c0f8' 
  AND (
    token = '5V1AE7ah6YuP+4jKMV/wA8W4KazFqVtlXurMbaQ7mGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047