UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lT5tilFBjGLdBNww9X+0I1+0UultGzGktJxDVk5Evtc=' 
WHERE 
  key_id = '5d53346418c3b801216ca7a8d5d384f90956265dc61c70c3936b7db367a27841' 
  AND (
    token = 'lT5tilFBjGLdBNww9X+0I1+0UultGzGktJxDVk5Evtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040