UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e38tskeDec+ia7SNdjbGzceqAXmhfPCUqZam27znk9o=' 
WHERE 
  key_id = '05dbba22d5f31488ad5d3fd9c479b055257d852a6852e216147897c5d09ed2cd' 
  AND (
    token = 'e38tskeDec+ia7SNdjbGzceqAXmhfPCUqZam27znk9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025