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

Query time 0.00026