UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SxhTGf10pu285l1hRUBtBjALkMJvhTkFhhfVrKCv1rk=' 
WHERE 
  key_id = 'cdde243f7b956c1a04f9ab06f05e31ee9c56b309adf08107255d7e59842fd608' 
  AND (
    token = 'SxhTGf10pu285l1hRUBtBjALkMJvhTkFhhfVrKCv1rk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030