UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r7Ie8koEyyUSVcR+KRlMbuEYE+aM/rOrIpi9X+fHdJg=' 
WHERE 
  key_id = 'c41b099d71161d1594efc36106697e88bf8c306b42f593a418e4290fc4a2623f' 
  AND (
    token = 'r7Ie8koEyyUSVcR+KRlMbuEYE+aM/rOrIpi9X+fHdJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053