UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z8ua1dPDgiT438O72ncT2RxpYzTZHxZUqOOlDH2mrZg=' 
WHERE 
  key_id = '52984a07029f36115940494672e159c81fb2faa3b06935c4afca70f5343bde4d' 
  AND (
    token = 'z8ua1dPDgiT438O72ncT2RxpYzTZHxZUqOOlDH2mrZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020