UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kyL2N4NzAQZoOQSosw0XSDMSB7AeCjL5cz9Olta4nQ4=' 
WHERE 
  key_id = 'aa470547b8afc8b9a91279e0c2cf54b5016f5287f5e63a66809abaa1afc6fdbd' 
  AND (
    token = 'kyL2N4NzAQZoOQSosw0XSDMSB7AeCjL5cz9Olta4nQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037