UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VZtoBZ8626Roy7nQJih6PgCaz3CSeSV0n4fB4JBoNHk=' 
WHERE 
  key_id = '2ee4e396a788b06041967194c8b432141677531a2e47150b7462b69386ba37dc' 
  AND (
    token = 'VZtoBZ8626Roy7nQJih6PgCaz3CSeSV0n4fB4JBoNHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035