UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x3YjO9+gAcrNtUgDn7IoZspgOMbT9l2B1zk7pH8xJR8=' 
WHERE 
  key_id = '7b83e1affdfb5b8d6be88137c06afdfe416fa353144bc4aafe556f739ccd7b92' 
  AND (
    token = 'x3YjO9+gAcrNtUgDn7IoZspgOMbT9l2B1zk7pH8xJR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037