UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FV49iIcrnH7bhyJFQm+05ObWnZ7hPevWLHkS8F5ntZE=' 
WHERE 
  key_id = '9b974f815cebc0b656b8965e26d1b4375a878989e665cf69ff5506a9002d7940' 
  AND (
    token = 'FV49iIcrnH7bhyJFQm+05ObWnZ7hPevWLHkS8F5ntZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046