UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b1g/wpQzwYr4Q2AFMwkBHbQdMewxwgdVmVem/B9Z51Q=' 
WHERE 
  key_id = 'd8fe31c5f999b68c5a13901b9c0ae67fab3e928f6b67324ae6328d566371f835' 
  AND (
    token = 'b1g/wpQzwYr4Q2AFMwkBHbQdMewxwgdVmVem/B9Z51Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038