UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ZxXkb18UBsPGNtTIMJqBAXgii692UhR+t/3KMNrbhg=' 
WHERE 
  key_id = 'a9bbdbf6b6108e243995a0a2f586dffdd05c1e9980e7b31f525c91fe14c8bef0' 
  AND (
    token = '+ZxXkb18UBsPGNtTIMJqBAXgii692UhR+t/3KMNrbhg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037