UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UdJBN+t5nhFxBPr4MLmat47cBWHo0v8TrdpZcufB5hU=' 
WHERE 
  key_id = '4bbc055599213f515568e05c1df4d3b7b23d1d8a11dfcae5502f2c4072579a02' 
  AND (
    token = 'UdJBN+t5nhFxBPr4MLmat47cBWHo0v8TrdpZcufB5hU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041